<template>
    <div id="order-manage">
        <div class="title">
            <h1 @click="goBack">《返回列表</h1>
        </div>
        <div class="searchInfo">
            <el-form ref="form" :model="search_Data" label-width="80px" size="medium" :label-position="labelPosition"
            style="text-align:right ;"
            >
                <div class="search_col_top">
                    <el-form-item label="用户ID:">
                        {{userId}}
                    </el-form-item>
                    <el-form-item label="用户手机:">
                        {{userTel}}
                    </el-form-item>
                    <el-form-item label="年份">
                        <el-select v-model="search_Data.year" placeholder="请选择年份" style="width: 150px" clearable>
                            <el-option label="2019" value="2019"></el-option>
                            <el-option label="2020" value="2020"></el-option>
                            <el-option label="2021" value="2021"></el-option>
                            <el-option label="2022" value="2022"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="月份">
                        <el-select v-model="search_Data.month" placeholder="请选择月份" style="width: 150px" clearable>
                            <el-option label="1" value="1"></el-option>
                            <el-option label="2" value="2"></el-option>
                            <el-option label="3" value="3"></el-option>
                            <el-option label="4" value="4"></el-option>
                            <el-option label="5" value="5"></el-option>
                            <el-option label="6" value="6"></el-option>
                            <el-option label="7" value="7"></el-option>
                            <el-option label="8" value="8"></el-option>
                            <el-option label="9" value="9"></el-option>
                            <el-option label="10" value="10"></el-option>
                            <el-option label="11" value="11"></el-option>
                            <el-option label="12" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-button type="info" @click="onSearchBtn">查询</el-button>
                </div>
            </el-form>

        </div>
        <!-- 表格 -->
        <el-table :data="tableData" tooltip-effect="dark" style="width: 100%;line-height: 0; margin-top: 20px;">
            <el-table-column prop="area" label="打卡区域" align="center">
            </el-table-column>
            <el-table-column prop="date" label="打卡时间" align="center">
            </el-table-column>
            <el-table-column prop="payment" label="支付方式" align="center">
            </el-table-column>
            <el-table-column prop="startTime" label="开始时间" align="center" width="180" >
            </el-table-column>
            <el-table-column prop="endTime" label="结束时间" align="center" width="180" >
            </el-table-column>
        </el-table>
        <el-pagination 
            style="float:right" 
            @current-change="handleCurrentChange" 
            :current-page.sync="page"
            :page-size="limit" 
            layout="prev, pager, next" 
            :total="total">
        </el-pagination>
    </div>
</template>

<script>
export default {
    data() {
        return {
            labelPosition: "center",
            search_Data: {
                year:null,
                month:null
            },
            tableData: [{
                list:null
            }],
            page: 1,
            limit: 5,
            total: null,
            userId:null,
            userTel:null,
        }
    },
    methods: {
        getData(){
            this.$axios({
                url:'/clock/list',
                method:'get',
                params:{
                    userId:this.userId,
                    year:this.search_Data.year,
                    month:this.search_Data.month,
                    limit:this.limit,
                    page:this.page
                }
            }).then(({data})=>{
                console.log(data.data);
                this.tableData=data.data.clocks,
                this.total=data.data.totalCount
            })
        },
        // 查询按钮
        onSearchBtn() {
            this.getData()
        },
        // 取消订单
        handleCurrentChange (v) {
            this.page=v,
            this.getData()
        },
        goBack(){
            this.$router.push('/home/UserList')
        }
    },
    mounted(){
        this.userId=this.$route.query.id,
        this.userTel=this.$route.query.tel,
        this.getData()
    }
}


</script>


<style scoped lang="less">
#order-manage {
    width: 100%;
    height: 100%;
    // outline: 1px solid red;

    &>.title {
        line-height: 0;
        text-align: left;
    }
    &>.title h1{
        color: #48c0f4;
            cursor: pointer;
    }
    & .searchInfo {
        width: 100%;
        height: 50px;
        background: #d7d7d7;
        margin-top: 30px;
        padding-left: 10px;
        box-sizing: border-box;
        position: relative;
        min-width: 1440px;

        & .search_col_top {
            width: 100%;
            height: 50px;
            display: flex;
            align-items: center;
        }

        .el-form {
            height: 50px;
        }

        .el-form-item {
            margin-bottom: 0;
        }

        .el-form-item__label {
            padding-left: 20px;
        }

        .el-button {
            position: absolute;
            right: 200px;
        }

        .el-form-item__label {
            text-align: center;
            vertical-align: middle;
            float: left;
            font-size: 14px;
            color: #606266;
            line-height: 40px;
            /* padding: 0 12px 0 0; */
            box-sizing: border-box;
        }


    }

    


}
</style>